/**
 * 
 */
package com.aspire.android.heliar.pub;

import java.util.LinkedList;
import java.util.List;

/**
 * @author panglei
 * 
 */
public class ContentNode {
	
	private long id;
	private String title;
	private String content;
	private String author;
	private long pubId;
	private long parentId;
	
	private int level = 1;	//Node level, the first node's level is 1

	private ContentNode parentNode;
	private List<ContentNode> childNodes = new LinkedList<ContentNode>();
	//private Map<String, PubAttachment> attachments = new LinkedHashMap<String, PubAttachment>();
	private List<PubAttachment> attachments = new LinkedList<PubAttachment>();

	public void addChildNode(ContentNode contentNode) {
		contentNode.setLevel(this.level + 1);
		childNodes.add(contentNode);
		
	}
	
	public ContentNode getLastContentNode() {
		if (childNodes.size() > 0) {
			return childNodes.get(childNodes.size() - 1);
		}
		return null;
	}

	public void addAttachment(PubAttachment pubAttachment) {
		attachments.add(pubAttachment);
	}

	public String getTitle() {
		return title;
	}

	public void setTitle(String title) {
		this.title = title;
	}

	public String getContent() {
		return content;
	}

	public void setContent(String content) {
		this.content = content;
	}

	public List<ContentNode> getChildNodes() {
		return childNodes;
	}

	public void setChildNodes(List<ContentNode> childNodes) {
		this.childNodes = childNodes;
	}

	public String getAuthor() {
		return author;
	}

	public void setAuthor(String author) {
		this.author = author;
	}

	public ContentNode getParentNode() {
		return parentNode;
	}

	public void setParentNode(ContentNode parentNode) {
		this.parentNode = parentNode;
	}

	public int getLevel() {
		return level;
	}

	public void setLevel(int level) {
		this.level = level;
	}

	public long getId() {
		return id;
	}

	public void setId(long id) {
		this.id = id;
	}

	public long getPubId() {
		return pubId;
	}

	public void setPubId(long pubId) {
		this.pubId = pubId;
	}

	public long getParentId() {
		return parentId;
	}

	public void setParentId(long parentId) {
		this.parentId = parentId;
	}

	public List<PubAttachment> getAttachments() {
		return attachments;
	}

	public void setAttachments(List<PubAttachment> attachments) {
		this.attachments = attachments;
	}

}
